﻿@model SettingsModel
@{
    Layout = "_Default";
}

@section css {
    <style>
    </style>
}
@section javascript{
    <script>
        $(function () {
            var $btnSaveCss = $('#btnSaveCss');

            $btnSaveCss.click(function () {
                $.ajax({
                    url: '/api/sysconfig',
                    type: "get",
                    data: { 'themeName': $('#themeList').val() },
                    success: function (res) {
                        if (res.state == 200) {
                            toastr.success(res.message);
                            setTimeout(function () { window.location.reload(); }, 500);
                        }
                        else {
                            toastr.error(res.message);
                        }
                    },
                    error: function (e) {
                        toastr.error(e.responseText);
                    }
                });
            });

            $('#ClearCache').click(function () {
                $.ajax({
                    url: '/api/sysconfig',
                    type: "POST",
                    success: function (res) {
                        if (res.state == 200) {
                            toastr.success(res.message);
                            setTimeout(function () { window.location.reload(); }, 500);
                        }
                        else {
                            toastr.error(res.message);
                        }
                    },
                    error: function (e) {
                        toastr.error(e.responseText);
                    }
                });
            });

            $('#refreshCache').click(function () { window.location.reload(); });
        });
    </script>

}

<div class="content-header">
    <div class="container-fluid">
        <div class="row mb-2">
            <div class="col-sm-6">
                <h1 class="m-0 text-dark">网站设置</h1>
            </div>
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-right">
                    <li class="breadcrumb-item"><a href="@CoreConfiguration.DefaultMain">首页</a></li>
                    <li class="breadcrumb-item active">网站设置</li>
                </ol>
            </div>
        </div>
    </div>
</div>

<div class="card">
    <div class="card-header">网站样式</div>
    <div class="card-body">
        @*<div class="alert alert-info" role="alert">
                <span>注意：本设置将覆盖<b>网站设置</b>中设置的网站样式</span>
            </div>*@
        <form class="form-inline">
            <div class="row">
                <div class="form-group col-sm-6 col-lg-auto">
                    <label class="control-label">系统主题</label>
                    <div class="input-group flex-sm-fill">
                        <select class="selectpicker selectc" id="themeList" style="text-align: center; text-align-last: center;" name="messageName" data-dropup-auto="false">
                            @if (Model.CoreWebTheme == "lte")
                            {
                                <option value="lte" selected>默认样式</option>
                                <option value="blue">Blue</option>
                            }
                            else
                            {
                                <option value="lte">默认样式</option>
                                <option value="blue" selected>Blue</option>
                            }
                        </select>
                    </div>
                </div>
            </div>
        </form>
        <div class="modal-footer">
            <button id="btnSaveCss" data-method="profileCss" class="btn btn-info" type="button"><span>保存</span></button>
        </div>
    </div>
</div>
<div class="card">
    <div class="card-header">
        <div class="d-flex align-items-center">
            <span class="flex-fill">网站缓存</span>
            <a data-method="clear" href="#" class="fa fa-times-circle-o" id="ClearCache" title="" data-toggle="tooltip" data-placement="left" data-original-title="全部清除"></a>
            <a data-method="refresh" href="#" class="fa fa-refresh ml-3" id="refreshCache" title="" data-toggle="tooltip" data-original-title="点击刷新"></a>
        </div>
    </div>
    <div class="card-body" id="sortable">
        <div class="card-cache">
            <h6>系统后台数据缓存</h6>
            @foreach (var item in Model.CacheKeyList)
            {
                <div class="cache-item">
                    <i class="fa fa-ellipsis-v"></i>
                    <span data-toggle="tooltip" title="" data-original-title="@item">@item</span>
                    <span class="badge badge-pill badge-success"></span>
                    <span title="List`1"></span>
                    <div>
                        <span></span>
                        <button class="btn btn-danger" style="display:none" data-toggle="tooltip" data-self="true" data-placement="left">
                            <i class="fa fa-trash-o"></i>
                        </button>
                    </div>
                </div>
            }
        </div>
    </div>
</div>